package cn.fenqing168.nio;

import java.nio.ByteBuffer;

/**
 * @author fenqing
 */
public class BufferPutGet {

    public static void main(String[] args) {

        ByteBuffer buffer = ByteBuffer.allocate(1024);
        buffer.putLong(1);
        buffer.put((byte) 1);
        buffer.putInt(1);
        buffer.putShort((short) 1);
        buffer.putDouble(1);
        buffer.putFloat(1);
        buffer.putChar('1');

        buffer.flip();

        long data1 = buffer.getLong();
        byte data2 = buffer.get();
        int data3 = buffer.getInt();
        short data4 = buffer.getShort();
        double data5 = buffer.getDouble();
        float data6 = buffer.getFloat();
        char data7 = buffer.getChar();

        ByteBuffer buffer1 = buffer.asReadOnlyBuffer();

    }

}
